#ifndef CPUINTERFACE_H
#define CPUINTERFACE_H

#include <QtWidgets/qwidget.h>
#include <QLibrary>
#include <QTimer>
#include "basicinterface.h"
#include "cpuminiondata.h"
#include "cpugamedata.h"
#include "cpucommand.h"
#include "../GameEngine/minion.h"

class CpuInterface : public QWidget, public BasicInterface
{
    Q_OBJECT

    typedef void (*LibInitPtr)(GameData *);
    typedef void (*LibTickPtr)(int playerid, QVector<MinionData> &, CpuCommand &);

    QLibrary CpuLibrary;
    QTimer CpuTimer;

    LibInitPtr InitFunction;
    LibTickPtr TickFunction;

    GameData GameInfo;

public:
    CpuInterface(QString &library_name);
    void GameStarted(int playerid, QPair<int,int> const &MapSize);

private:
    void GetVisibleObjects(QVector<MinionData> &VisibleObjects);
    void CopyMyMinion();

private slots:
    void Tick();
};

#endif // CPUINTERFACE_H
